package com.oracle.rentcar.controller;

import com.oracle.rentcar.util.Constant;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

@Controller
@RequestMapping("system")
public class SystemController {

    @ResponseBody
    @RequestMapping("change_page_size")
    public Map<String,Object> changePageSize(int pageSize){

        //修改每页行数
        Constant.PAGE_SIZE = pageSize;

        Map<String,Object> result = new HashMap<>();
        result.put("success", true);
        result.put("msg", "ok");

        return result;
    }

    //去后台首页
    @RequestMapping("main")
    public String main(){
        //转发到/templates/bg_main.html
        return "bg_main";
    }

    @RequestMapping("to_login")
    public String toLogin(){
        //转发到/templates/login.html
        return "login";
    }

}
